﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using KT.Framework.Web;
using ZhuGe.DAL.SqlServer;

namespace ZhuGe.Web
{
    /// <summary>
    /// blogdetail 的摘要说明
    /// </summary>
    public class blogdetail : VTemplatePage
    {

        /// <summary>
        /// 初始化页面模板
        /// </summary>
        public override void InitPageTemplate()
        {
            this.LoadCurrentPageTemplate();

            string id=Request.QueryString["id"].ToString();

            if(id==null || id=="")
            {
                Response.Write("<script>window.lcoation.href='index.ashx';</script>");
                return;
            }

            this.Document.SetValue("Lables", SqlHelper.ExecuteDataSet("SELECT * FROM T_Lables", "Lables", null));
            this.Document.SetValue("Blog", SqlHelper.ExecuteDataSet("SELECT * FROM T_Blogs WHERE ID=" + id, "Blogs", null).Tables[0].Rows[0]);

            SqlHelper.ExecuteNonQuery("update T_Blogs set Clicks=Clicks+1 where ID=" + id);
        }

        /// <summary>
        /// 站点的配置
        /// </summary>
        public override WebSiteConfiguration Configuration
        {
            get
            {
                return WebSiteConfiguration.From<WebSiteConfiguration>("website.config");
            }
        }
    }
}